Repository navigation
fix(core-ts,mcp-server): RFC-0045 step 7a, held rows for old-shape values and whole-list re-translation - #221
Merged
Merged
Conversation
…lues and whole-list re-translation #215: while a top-level conversion from references runs with no text <-> reference path (reference (multiple) <-> repeater, single <-> multiple, a repeater converting away), a stored old-shape value that does not convert now keeps its entry_refs rows through a person's unrelated write. normalizeWrite holds them at the old type's paths, the same pairs the rebuild keeps (one helper, references/old-shape.ts oldShapePairs), so the rows and the target's delete guard no longer depend on whether a write or a reimport touched the node last. Shared-suite test on SQLite, Miniflare D1 and DO SQLite. #218: once a translation holds its own list for a localized repeater, get_translation_source returns the source's whole list for that key under fields (source order, every sub-value) instead of item paths, and names it in a new wholeLists output (core-ts translationSourceValues). The translation_shape_mismatch hint, TRANSLATED_FIELDS and the tool descriptions say to send it back whole. The RFC (Amended in 7a) and a new changeset qualify the step-5 wording: the length check applies only when item paths come in the same call; a whole list sent alone is stored as sent. Test for list_stale_translations -> get_translation_source -> save_translation. Closes #215, closes #218. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Madraka <[email protected]>
- Held entry_refs rows follow their holder's status: when a write holds pairs, the same batch updates their source_status to the entry's new status, anchored on its new hash (references/held-status.ts). Covers reshapes and text <-> reference held values. Suite cases: publish locks the target, unpublish frees it, and a reference -> text held row. - Rebuild legs are real: rebuildingImport adds a node after the export and drops the site's rows first, and asserts the import is not unchanged. The four no-op reimports in testing-field-operations-references.ts use it too. Rows are compared with source_status. - translation_shape_mismatch hint covers both refusals (own list, and a whole list beside paths of another length). - get_translation_source's description names wholeLists; the pending step-5 changeset states the length rule as it is, and the 7a changeset drops its redundant bullet. - save_translation checks a given sourceRev against whole repeater lists too (conflict when the source moved on); optional there. Test added. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Madraka <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
RFC-0045 rollout step 7a: the two latent issues to fix before step 7b enables reference and repeater fields. Both types stay refused on every production write path; the shared suites enable them with
SiteGraphStoreOptions.fieldTypes.Closes #215, closes #218.
#215: old-shape values keep their
entry_refsrows (core-ts)normalizeWrite→onUnconvertibleused to return early whenconvertingPath(def)was undefined. That covers every top-level conversion from references with no text ↔ reference path: reference (multiple) ↔ repeater, reference single ↔ multiple, and a repeater converting away.entryRefStatementsdropped its rows on any unrelated write.<field>from a reference, and each item's id-shaped sub-value at<field>.<sub>from a repeater.heldRefsandentryRefStatementskeep them, and every stored failing id is held, as before for conversions from references.reshapedRowsand the writer share one helper,references/old-shape.ts(readsOldShape,oldShapePairs), so the rows are the same whichever touched the node last.src/testing-field-operations-old-shape.ts, registered in the shared suite, so it runs on SQLite, Miniflare D1 and DO SQLite. It fails on all three without the fix.[id, 5], injected withjson_setas an import could hold it):entry_referenced;field_operation_runningfor the whole operation, because a conversion into references holds them (R12). So the row checks carry this case.#218: re-translating a repeater the translation already holds (mcp-server, core-ts)
When the existing translation (the one
save_translationwrites) holds its own list for a localized repeater,get_translation_sourcereturns the source's whole list for that key underfields, in source order and with every sub-value, instead of item paths. A newwholeListsoutput names those keys. The logic is in core-tstranslationSourceValues(new export); MCP'stranslationSourceFieldstakes the existing translation.Updated text:
translation_shape_mismatchhint infield-hints.ts(send the whole list, asget_translation_sourcereturns it, and no item paths for it);TRANSLATED_FIELDS;get_translation_source'sfieldsandwholeListsdescriptions;save_translation's description.The README tool table is unchanged after
node scripts/mcp-tools-doc.ts: it truncates before the edited part, and--checkpasses.Docs:
.changeset/rfc45-step7a-fixes.md(core-ts and mcp-server, patch) qualifies the step-5 wording. The step-5 changeset is untouched.fields/translation.ts(baseList) andtranslation-fields.tssay the same.Tests:
mcp-server/test/references.test.ts, "re-translates a stale repeater: list_stale_translations → get_translation_source → save_translation":get_translation_sourcereturnswholeLists: ["agenda"]and the source's list;fields-translation.test.ts: unit cases fortranslationSourceValues, and for a whole list sent alone being stored as sent.Local checks
test/store.test.ts:EADDRNOTAVAIL).fields-translation.test.ts: 11 passed. mcp-serverreferences.test.ts: 17 passed.pnpm size:check, typecheck, biome andmcp-tools-doc --check: clean.pnpm check: result in the session report.🤖 Generated with Claude Code